﻿<h3>TestBootstrapChartBubble</h3>
<Chart ChartType="ChartType.Bubble" OnInitAsync="@OnInitAspectRatio" Height="300px" />
@code {
    private Random Randomer { get; } = new();

    private int BubbleDatasetCount = 2;

    private int BubbleDataCount = 7;
    private Task<ChartDataSource> OnInitAspectRatio()
    {
        var ds = new ChartDataSource
            {
                Labels = Enumerable.Range(1, BubbleDataCount).Select(i => i.ToString())
            };
        ds.Options.Title = "Bubble chart";

        for (var index = 0; index < BubbleDatasetCount; index++)
        {
            ds.Data.Add(new ChartDataset()
                {
                    Label = $"Set {index}",
                    Data = Enumerable.Range(1, BubbleDataCount).Select(i => new
                    {
                        x = Randomer.Next(10, 40),
                        y = Randomer.Next(10, 40),
                        r = Randomer.Next(1, 20)
                    })
                });
        }
        return Task.FromResult(ds);
    }
}
